import java.util.Scanner;

public class Search {

	public static void main(String[] args) {
		int count = 0;
		Scanner input = new Scanner(System.in);
		String a = "this is a dog";
		String b = "dog";
		int c = b.length();
		for (int i = 0, j = i + c; j <= a.length(); i++, j++) {
			String d = a.substring(i, j);
			if (d.equals(b)) {
				count++;
			}
		}
		System.out.println(count);
	}
}
